<template>
    <div>

        <el-dialog :title="title" :visible.sync="open" width="85%" :before-close="closeDelDialog" append-to-body>
            <el-row :gutter="20">
                <el-col :span="13">
                    <addField v-if="infoList.length > 0" :infoList="infoList" :inputParams="inputParams"
                        @onChangeTap="onChangeTap" :leftjianjuanMain="'leftMain'"></addField>
                    <el-empty v-else description="暂无著录数据" class="leftMain"></el-empty>
                    <el-row class="upLoadMain">
                        <el-col :span="24" style="display: flex;">
                            <el-select v-model="uploadValue" placeholder="请选择文件类型" @change="selectChange($event)">
                                <el-option v-for="item in arrType" :key="item.dictValue" :label="item.dictLabel"
                                    :value="item.dictValue">
                                </el-option>
                            </el-select>
                            <!-- <el-upload 　　class="upload-file-demo" 　　action="上传的url" 　　ref="uploadComp"
                                　　:auto-upload="false" 　　:show-file-list='false' :file-list="fileList"
                                　　:on-change="handleChange" 　　:on-success="handleAvatarSuccess2"
                                　　:on-exceed="handleExceed2" :disabled="loading" 　　:data="uploadData" 　　accept=""
                                :http-request="uploadFile">
                                　　<el-button :loading="loading" class="upload_btn" size="medium" type="primary"
                                    icon="el-icon-upload">上传文件</el-button>
                                <span style="color: red">（温馨提示：单个文件不超过5M）</span>
                            </el-upload> -->
                            <!-- 上传功能 -->

                            <el-button class="upload_btn" type="primary" icon="el-icon-upload" v-if="!uploadValue"
                                @click="uploadTap" style="margin-bottom:5px;">上传文件</el-button>
                            <zdyfileUpload :uploadData="uploadData" :uploadList="uploadList" :uploadFileUrl="uploadFileUrl"
                                istype="1" :value="value" @handleUploadSuccess="handleUploadSuccess" v-else>
                            </zdyfileUpload>
                        </el-col>
                        <el-col :span="24">
                            <!-- 文件显示列表 -->
                            <fileList :uploadList="uploadList" :tableHeaderList="tableHeaderList"
                                @celldblclick="celldblclick" @onClickDocumentTap="onClickDocumentTap" @delTap="delTap"
                                @onDocToOfd="onDocToOfd" @identifyTap="identifyTap" :openInfo="openInfo"  :inputParams="inputParams">
                            </fileList>

                        </el-col>
                    </el-row>
                </el-col>
                <el-col :span="11">
                    <!--
                         文件预览
                         1、修改添加文件预览istype="1"
                         2、查看组件详情istype="2"
                     -->
                    <filePreviewTemplate v-if="item != '' && isItemShow" :item="item" :istype="istype">
                    </filePreviewTemplate>
                </el-col>
            </el-row>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="closeDelDialog">取消</el-button>
                <!--isParams==1||7 离线接收,待归档显示 -->
                <el-button type="primary"
                    v-if="(isParams == 1 && openInfo.ids == undefined) || (isParams == 7 && openInfo.ids == undefined)"
                    @click="submitDetail(1)">继承追加</el-button>
                <el-button type="primary" @click="submitDetail">确定</el-button>
            </div>
            <!-- 电子文件补充属性信息弹出 -->
            <eleDoc v-if="eleDocOpen" :roweleInfo="roweleInfo" :open="eleDocOpen" :infoList="addfileColumn"
                :inputParams="inputeleDocParams" @closeDeleleDocDialog="closeDeleleDocDialog"></eleDoc>
        </el-dialog>
    </div>
</template>
<script>
import {
    getrelevanceforadd,
    docToOfd,
    identify,
    getaddfield,
    getupdatefield,
    getYqdaById,
    getYqdaId,
    updateYqda,
    getshowfield,
    addYqda,
    getDocumentBydaId,
    getDocumentById,
    delDocument,
    updateYqda1, addYqda1, updateYqda2, getDataInfo, getfieldbycategoryid, getbgqxbyfile, addYqdaDgd, updateYqdaDgd, determine, fbstat
} from "@/api/archive/fileCollection/offlinReception.js";
import addField from "@/views/archive/fileCollection/offlinReception/addField.vue"  //著录字段列表、
import filePreview from "@/components/filePreview/index.vue"
import zdyfileUpload from "@/components/FileUpload/zdyIndex.vue" //文件上传
import fileList from "@/components/FileUpload/fileList.vue" //文件列表
import { addDaFile, updateDaFile } from "@/api/archive/digitalizeReceive/archiveReception"; // 数字化成果接收--档案接收
import filePreviewTemplate from "@/components/filePreviewTemplate/index.vue"  //文件预览模板
import eleDoc from "@/views/archive/fileCollection/offlinReception/electronicDocumentsInfo.vue"
import { getGroupTree } from "@/api/archive/archivesCategory.js"
import { getDicts_archive } from '@/api/archive/dict/dictManageData'
import { addZjYqda } from "@/api/archive/digitalizeReceive/archivesCollection"; // 数字化成果接收--档案征集
import {
    addYqdaDajsgl
} from "@/api/archive/digitalizeReceive/receivieManagement";
import { addYqdaZxjs, addYqdaZxjs2, updateYqdaZxjs } from "@/api/archive/fileCollection/onlineReception";  // 数字化成果接收--接收管理
import { deptTreeNoDateScope } from "@/api/system/user";
import { getZyTree } from "@/api/stage/stageManagement/professionalComparison";
import { iszt } from '@/api/archive/dict/dictManageData'
export default {
    archive_Dicts: ['TYPE'], // 门类树添加---原文类型
    components: {
        addField,
        filePreview,
        zdyfileUpload,
        fileList,
        filePreviewTemplate,
        eleDoc
    },
    watch: {
        openInfo: {
            handler(valNew) {
                //著录获取归档范围字段
                getfieldbycategoryid({
                    categoryId: valNew.categoryId,
                    type: valNew.type
                }).then(res => {
                    if (res.code == "200") {
                        this.getfieldbycategoryid = res.data;
                    }

                }).catch(res => {

                })



                // console.log(valNew, "+++22222222222222222222222222222++++")
                this.getshowfieldPost(valNew) //上传的电子文件的table标题列表
                // 显示著录修改页面展示的下拉档案门类配置的文件类型
                getGroupTree(valNew.categoryId).then(response => {
                    getDicts_archive("TYPE").then(res => {
                        var json = response.data.fileTypes.split(",")
                        var arrType = [];
                        for (var i in res.data) {
                            for (var j in json) {
                                if (res.data[i].dictValue == json[j]) {
                                    arrType.push(res.data[i])
                                }
                            }
                        }
                        this.arrType = arrType;
                        // 默认选中第一个
                        if (this.arrType.length > 0) {
                            this.uploadValue = this.arrType[0].dictValue;
                            this.selectChange(this.uploadValue)
                        }
                    }).catch(error => {
                    })
                });
                if (valNew.ids == undefined) { //添加

                    if (valNew.subStr == "X" || valNew.subStr == "V") {
                        // console.log(valNew.parentId, "_______________")
                        if (valNew.parentId != undefined) {  //如果有卷ID，调用卷详情，显示当前卷详情的题名
                            getDataInfo({
                                infotype: 1,
                                datatype: 1,
                                categoryId: valNew.categoryId,
                                id: valNew.parentId,
                            }).then(res => {
                                if (res.data.datalist.length > 0) {
                                    var dataInfo = res.data.datalist.filter(res => {
                                        return res.FIELD_NAME == "TITLE"
                                    })
                                    console.log(dataInfo)
                                    this.title = dataInfo[0].value
                                }


                            })

                        } else {  //显示项目题名
                            this.title = valNew.label

                        }

                    } else {
                        this.title = '组件著录'
                    }

                    this.getaddfieldPost({
                        categoryId: valNew.categoryId,
                        menuId: valNew.menuId,
                        type: valNew.type
                    })
                    this.getYqdaIdPost();
                } else {
                    //修改
                    this.title = '组件修改'
                    this.deptTreeSelectPost();//部门列表，判断导入数据的时候获取_ID是否相等问题
                    iszt().then(response => {//判断是否是中铁项目1 是 调用专业列表  其余返回的数据都不是中铁项目    不调用
                        if (response == "1") {
                            this.getSpecialityTree();//专业列表，判断导入数据的时候获取_ID是否相等问题
                        }
                    })

                    this.getUpdatefieldPost(valNew);
                }
            },
            immediate: true
        },
    },
    props: ["openInfo", "open", "isParams"],
    data() {
        return {
            isItemShow: true,
            getfieldbycategoryid: [],//获取归档范围字段数组
            eleDocOpen: false, //电子文件补充属性信息弹出
            lists: [],
            inputList: [],
            loading: false,
            infoList: [],
            daId: "",//获取组件id
            daIdsList: [],//获取组件ids
            uploadData: undefined,//上传携带的参数
            uploadValue: undefined, //选择上传的文件
            uploadList: [],//文件列表
            maxLength: 0,
            value: [], //判断当前是否又文件列表数据，如果有，修改渲染，如果是【】，清空之前的数据
            uploadFileUrl: process.env.VUE_APP_BASE_API + "/archive/lxjs/upload",
            inputParams: "", //点击修改时获取的查询框的数据 ,
            inputeleDocParams: {},//点击电子文件获取的信息展示数据
            tableHeaderList: [],//上传文件的table 标题列表,
            fields: [],//上传文件和显示table 列表时候用地参数
            item: "",
            istype: "1",
            addfileColumn: [], //电子文件的著录input列表信息
            roweleInfo: {},
            // 标题
            title: '',
            BGQXList: [],//保管期限
            gxgxList: [],//关联关系列表
            showFieldFlag: false,
            arrType: [],//文件类型列表
            optionSelect: [],//部门
            specialityTreeList: [],//专业
        }
    },
    created() {
        // console.log(process.env.VUE_APP_BASE_API, "API")
        this.getDicts_archive('GXGX').then(response => {
            this.gxgx = response.data
        })

        this.getDicts_archive('BGQX').then(response => {
            this.BGQXList = response.data
        })

    },
    methods: {
        //获取著录字段
        getaddfieldPost(data) {
            this.$modal.loading("加载中...")
            getaddfield(data).then(response => {
                this.lists = response.data.addColumn;
                var listData = response.data.addColumn;
                let dataInfo = {};
                let arr = {};
                let gxgxShowType = {};
                //设置关联关系
                if (this.openInfo.folderId != undefined || this.openInfo.itemId != undefined) {
                    getrelevanceforadd({
                        categoryId: data.categoryId,
                        level: data.type,
                        itemId: this.openInfo.itemId,
                        folderId: this.openInfo.folderId
                    }).then(res => {
                        if (res.code == "200") {
                            this.gxgxList = res.data;

                            this.gxgxList.forEach((item, index) => {
                                listData.forEach((itemx, idx) => {
                                    if (itemx.SHOWTYPE == 7 || itemx.SHOWTYPE == 8 || itemx.SHOWTYPE == 10) {
                                        if (item.FIELDNAME == itemx.FIELD_NAME + "_ID") {
                                            gxgxShowType[item.FIELDNAME] = item.VALUE
                                        }

                                    }
                                    if (item.FIELDNAME == itemx.FIELD_NAME) {
                                        itemx.DEFAULT_VALUE = item.VALUE
                                    }

                                })
                            })

                            listData.forEach((item, index) => {
                                if (item.COL_WIDTH != null||item.COL_WIDTH>=0) {
                                    item.COL_WIDTH = item.COL_WIDTH <= 240 ? 240 : 610;
                                }
                                arr[item.FIELD_NAME] = item.DEFAULT_VALUE // 根据自己需求可以拼接
                                let { ZSFL } = item;
                                if (!dataInfo[ZSFL]) {
                                    dataInfo[ZSFL] = {
                                        ZSFL,
                                        child: []
                                    }
                                }

                                dataInfo[ZSFL].child.push(item);
                            });
                            // console.log(dataInfo,"ksdjflksjfklsdjfkldsjf------------------")
                            let merged = { ...arr, ...gxgxShowType };

                            this.infoList = Object.values(dataInfo); // list 转换成功的数据
                            // console.log(this.infoList,"l------------------------------------------------------------刘海容sdkfjsdklfjklsdfjksdlfjdskfjk")
                            this.inputParams = {};  //添加时传{}
                            this.getRQ(merged.RQ)
                            this.inputParams = merged;  //修改获取的输入框参数

                            this.inputList = merged; //修改时用来判断提示窗是否有值

                            this.$modal.closeLoading()
                        }

                    })
                } else {
                    listData.forEach((item, index) => {

                        if (item.COL_WIDTH != null||item.COL_WIDTH>=0) {
                                    item.COL_WIDTH = item.COL_WIDTH <= 240 ? 240 : 610;
                                }

                        arr[item.FIELD_NAME] = item.DEFAULT_VALUE // 根据自己需求可以拼接
                        let { ZSFL } = item;
                        if (!dataInfo[ZSFL]) {
                            dataInfo[ZSFL] = {
                                ZSFL,
                                child: []
                            }
                        }
                        dataInfo[ZSFL].child.push(item);
                    });

                    // console.log(dataInfo,"ksdjflksjfklsdjfkldsjf------------------")

                    this.infoList = Object.values(dataInfo); // list 转换成功的数据
                    // console.log(this.infoList,"l------------------------------------------------------------刘海容sdkfjsdklfjklsdfjksdlfjdskfjk")
                    this.inputParams = {};  //添加时传{}

                    this.getRQ(arr.RQ)
                    this.inputParams = arr;  //修改获取的输入框参数

                    this.inputList = arr; //修改时用来判断提示窗是否有值
                    this.$modal.closeLoading()
                }
                // console.log(arr, "+++++++++++++++++++++++++++++++++++++++++++")

            });
        },

        //获取修改字段
        getUpdatefieldPost(data) {
            getupdatefield({
                categoryId: data.categoryId,
                menuId: data.menuId,
                type: data.type
            }).then(response => {

                if (response.data.updateColumn.length > 0) {
                    this.lists = response.data.updateColumn;
                    var listData = response.data.updateColumn;
                    console.log(listData, "liuhaiorng1")
                    let dataInfo = {};
                    listData.forEach((item, index) => {
                        if (item.COL_WIDTH != null||item.COL_WIDTH>=0) {
                                    item.COL_WIDTH = item.COL_WIDTH <= 240 ? 240 : 610;
                                }
                        let { ZSFL } = item;
                        if (!dataInfo[ZSFL]) {
                            dataInfo[ZSFL] = {
                                ZSFL,
                                child: []
                            }
                        }
                        dataInfo[ZSFL].child.push(item);
                    });


                    console.log(dataInfo, "liuhairong2")
                    this.infoList = Object.values(dataInfo); // list 转换成功的数据
                    this.getYqdaByIdPost(data, this.lists)
                }
            });

        },

        //部门（单选）
        deptTreeSelectPost() {
            deptTreeNoDateScope().then(response => {
                this.optionSelect = response.data;
            })
        },

        //专业
        getSpecialityTree() {
            getZyTree().then(response => {
                this.specialityTreeList = response.data
            })
        },

        //递归获取部门ID
        processNode(data, id) {
            var result;
            //便利数组的没一个对象
            data.forEach(item => {
                if (item.id == id) { //检查当前对象的Id是否匹配
                    result = item.id
                    return
                }
                //如果当前对象有children属性，递归查找
                if (item.children) {
                    const childResult = this.processNode(item.children, id)
                    if (childResult) {
                        result = childResult; // 如果在子数组中找到匹配项，将其赋值给 result
                        // 并退出循环
                    }

                }
            })
            return result

        },
        /**
         * 修改字段
         * 获取组件详情**/
        getYqdaByIdPost(data, lists) {
            console.log(data, lists, "4")
            var column = [];

            for (var i in lists) {
                if (lists[i].SHOWTYPE == 7 || lists[i].SHOWTYPE == 8 || lists[i].SHOWTYPE == 10) {
                    column.push(lists[i].FIELD_NAME + '_ID')
                }
                column.push(lists[i].FIELD_NAME)
            }
            // console.log(column, "99999999999999999999999999999999999")
            getYqdaById({
                categoryId: data.categoryId,
                id: data.ids,
                column: column.toString()
            }
            ).then(res => {
                this.getRQ(res.data.RQ)
                for (var i in lists) {
                    if (lists[i].SHOWTYPE == 7 || lists[i].SHOWTYPE == 8 || lists[i].SHOWTYPE == 10) {
                        // console.log(res.data[lists[i].FIELD_NAME + '_ID'], "刘海容，45")
                        if (res.data[lists[i].FIELD_NAME + '_ID'] == null) { //判断如果归档处室的_ID是空的 就把GDSC值改成null
                            res.data[lists[i].FIELD_NAME] = null
                        } else { //如果ID不为空的情况下，判断是否匹配部门列表里面的ID,不过不匹配归档处室的_ID，归档处室 设置为null
                            var vari = "";
                            if (lists[i].SHOWTYPE == 7) {
                                vari = this.processNode(this.optionSelect, res.data[lists[i].FIELD_NAME + '_ID']) //递归方法判断是否有ID
                            } else if (lists[i].SHOWTYPE == 10) {
                                vari = this.processNode(this.specialityTreeList, res.data[lists[i].FIELD_NAME + '_ID']) //递归方法判断是否有ID
                            }

                            if (vari == undefined) {
                                res.data[lists[i].FIELD_NAME + '_ID'] = null
                                res.data[lists[i].FIELD_NAME] = null
                            }
                        }
                    }

                }
                this.inputParams = res.data;  //修改获取的输入框参数

                this.inputList = res.data; //修改时用来判断提示窗是否有值

                console.log(this.inputParams, this.inputList)
            })
        },


        getRQ(RQ) {
            if (RQ != null) {
                if (typeof (RQ) == "number") {
                    RQ = RQ.toString();
                }
                if (RQ.toString().indexOf('/') != -1) {
                    RQ = this.parseTime(RQ, '{y}{m}{d}');
                }

                var regDate = /(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})(((0[13578]|1[02])(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)(0[1-9]|[12][0-9]|30))|(02(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))0229)/;
                var isDate = regDate.test(RQ);
                if (!isDate) {
                    //       console.log("日期格式有误。请按示例格式填写");
                    const date = new Date()
                    const year = date.getFullYear()
                    const month = ('0' + (date.getMonth() + 1)).slice(-2)
                    const day = ('0' + date.getDate()).slice(-2)
                    RQ = year + "" + month + "" + day;
                    // return;
                }

            }
        },

        //获取修改的上传文件的列表标题数据  电子文件
        getshowfieldPost(data) {
            getshowfield({
                "level": "efile",
                "categoryId": data.categoryId,
                "menuId": data.menuId
            }).then(res => {
                if (Array.isArray(res.data) && res.data.length === 0){
                  this.showFieldFlag = true;
                  this.$message.warning('建议先完成电子文件层展示字段的配置！');
                }
                this.tableHeaderList = res.data;

                for (var i in res.data) {
                    this.fields.push(res.data[i].FIELD_NAME)
                }
                if (data.ids != undefined) { //如果当前是修改的状态下  不获取上传文件的列表
                    this.daId = data.ids;
                    this.getDocumentBydaIdPost(data, this.fields)
                }
            })
        },
        //获取修改的上传文件的数据列表数据  电子文件
        getDocumentBydaIdPost(data, fields) {

            getDocumentBydaId({
                categoryId: data.categoryId,
                daId: data.ids,
                fields: fields.toString(),
              menuId: this.openInfo.menuId,

            }).then(res => {
                for (var i in res.data) {
                    for (var j in this.dict.type.WJLX) {
                        if (res.data[i].TYPE == this.dict.type.WJLX[j].value) {
                            res.data[i].TYPE = this.dict.type.WJLX[j].label
                        }
                    }
                }
                this.uploadList = res.data;
                this.value = res.data;
                if (this.uploadList[0] != undefined) {
                    if (this.uploadList[0].TO_OFD == "1") {
                        this.uploadList[0]['DOC_FILE_TYPE'] = "OFD"
                    }
                    this.item = this.uploadList[0]; //文件预览显示第一个
                    this.item["categoryId"] = data.categoryId;
                }

            })
        },
        //补充属性信息
        onClickDocumentTap(row, type) {
            this.roweleInfo = {
                row: row,
                type: type,
                categoryId: this.openInfo.categoryId,
                MJ:this.inputList["MJ"]
            };
            this.eleDocOpen = true
            //获取著录电子文件input框列表
            getaddfield({
                categoryId: this.openInfo.categoryId,
                menuId: this.openInfo.menuId,
                type: 2,  //电子文件的著录
            }).then(response => {
                this.addfileColumn = response.data.addColumn
            });



            //过去电子文件信息
            getDocumentById({
                categoryId: this.openInfo.categoryId,
                docId: row.DOC_ID,
                column: this.fields.toString()
            }).then(res => {
                // res.data.ACTION_TIME = this.parseTime(res.data.ACTION_TIME, '{y}{m}{d}')
                // res.data.CREATE_TIME = this.parseTime(res.data.CREATE_TIME, '{y}{m}{d}')
                this.inputeleDocParams = res.data
            })

        },

        //关闭电子文件补充属性
        closeDeleleDocDialog(type, data) {
            this.eleDocOpen = false
            if (type == 'yes') {

                this.czlist(this.roweleInfo.row, this.roweleInfo.categoryId)
            }

        },


        //操作之后数据列表刷新  dataRow  当前操作的数据,  categoryId  当前操作的门类ID
        czlist(dataRow, dataRowcategoryId) {
            console.log("liuhaiorng")
            if (this.openInfo.ids == undefined) {
                getDocumentBydaId({
                    categoryId: this.openInfo.categoryId,
                    daId: this.daId,
                    fields: this.fields.toString(),
                }).then(res => {
                    for (var i in res.data) {
                        for (var j in this.dict.type.WJLX) {
                            if (res.data[i].TYPE == this.dict.type.WJLX[j].value) {
                                res.data[i].TYPE = this.dict.type.WJLX[j].label
                            }
                        }
                    }
                    this.uploadList = res.data;
                    this.value = res.data;
                    var data1 = res.data.filter(item => { return item.DOC_ID == dataRow.DOC_ID })
                     console.log(data1, "++++++++++++++++装换后调用的接口+++++")
                    if (data1[0].TO_OFD === 1) {  //转换后  预览ofd类型
                        data1[0]['DOC_FILE_TYPE'] = "OFD"
                    }
                    this.item = data1[0]; //文件预览显示当前操作数据

                    console.log( this.item,"++++++1++++++++++装换后调用的接口+++++")
                    this.item["categoryId"] = dataRowcategoryId;
                    this.isItemShow = true;

                })
            } else {
                getDocumentBydaId({
                    categoryId: this.openInfo.categoryId,
                    daId: this.openInfo.ids,
                    fields: this.fields.toString(),
                    menuId: this.openInfo.menuId,
                }).then(res => {
                    for (var i in res.data) {
                        for (var j in this.dict.type.WJLX) {
                            if (res.data[i].TYPE == this.dict.type.WJLX[j].value) {
                                res.data[i].TYPE = this.dict.type.WJLX[j].label
                            }
                        }
                    }
                    this.uploadList = res.data;
                    this.value = res.data;
                    var data1 = res.data.filter(item => { return item.DOC_ID == dataRow.DOC_ID })
                    console.log(data1, "++++++++++++++++装换后调用的接口+++++")
                    if (data1[0].TO_OFD === 1) {  //转换后  预览ofd类型
                        data1[0]['DOC_FILE_TYPE'] = "OFD"
                    }
                    this.item = data1[0]; //文件预览显示当前操作数据
                    this.item["categoryId"] = dataRowcategoryId;
                    this.isItemShow = true;

                })
            }
        },



        //获取组件id
        getYqdaIdPost(val) {
            getYqdaId().then(res => {

                this.daIdsList.push(res.data)

                this.daId = res.data
                console.log(this.uploadData, '3')
                if (this.uploadData != undefined) {
                    this.uploadData['daId'] = res.data;  //上传文件接口从新复制daId
                }


            })
        },


        //上传文件类型的下拉框
        selectChange(event) {
            if (this.openInfo.ids != undefined) {
                this.uploadData = {
                    categoryId: this.openInfo.categoryId,
                    type: event,
                    daId: this.openInfo.ids,
                    fields: this.fields
                }
            } else {
                this.uploadData = {
                    categoryId: this.openInfo.categoryId,
                    type: event,
                    daId: this.daId,
                    fields: this.fields
                }
            }

        },
        uploadTap() {
            if (this.uploadData == undefined) {
                this.$message.warning(`请选择文件类型`);
                return false
            }
        },

        //上传成功
        handleUploadSuccess(data, newData) {
            this.uploadList = data;
            if(this.showFieldFlag){
              this.$message.warning('建议先完成电子文件层展示字段的配置！');
            }
            this.item = newData[0].data.docInfo; //文件预览显示第一个
            this.item.categoryId = this.openInfo.categoryId;
            console.log(data, newData, "+++++++++++++++++")
        },

        //删除上传文件
        delTap(row) {
            this.isItemShow = false;
            //      console.log(this.daId, "--")
            this.$modal.confirm('是否确认删除所选数据项？').then(function () {
            }).then(() => {
                delDocument({
                    categoryId: this.openInfo.categoryId,
                    ids: row.DOC_ID,
                    daId: this.daId
                }).then(res => {
                    if (res.code == "200") {
                        for (var i in this.uploadList) {
                            if (this.uploadList[i].DOC_ID == row.DOC_ID) {
                                this.uploadList.splice(i, 1)
                            }
                        }
                        //删除电子文件数据，清空预览文件
                        this.item = []
                        this.isItemShow = true;
                        this.$modal.msgSuccess("删除成功");
                    }
                })

            }).catch(() => {
                this.isItemShow = true;
            });



        },
        //预览文件
        // onPreviewTap(data) {
        //     // fileLiu({
        //     //     docId: data.DOC_ID,
        //     //     categoryId: this.openInfo.categoryId
        //     // }).then(res => {
        //     //     console.log(res, "sdklfjsdklfjkl")
        //     // })

        //     console.log(data,"___________________________")
        //     this.value = data;
        //     this.item = data; //文件预览显示第一个
        //     this.item.categoryId = data.categoryId;
        // },

        //双击电子文件列表数据 预览文件
        celldblclick(data) {
            if (data.TO_OFD === 1) {  //转换后  预览ofd类型
                data['DOC_FILE_TYPE'] = "OFD"
            }
            this.item = data; //文件预览显示第一个
            this.item.categoryId = this.openInfo.categoryId;

            // this.value = data;
            //     this.item = data; //文件预览显示第一个
            //     this.item.categoryId = data.categoryId;
        },

        //转换
        onDocToOfd(data) {
            var that = this;
            this.isItemShow = false;
            this.$modal.confirm('是否确认转换"' + data.DOC_NAME + '"文件？').then(function () {
            }).then(() => {
                that.loading = true
                docToOfd({
                    categoryId: this.openInfo.categoryId,
                    docId: data.DOC_ID,
                }).then(res => {
                    if (res.code == "200") {
                        that.loading = false;
                        that.$modal.msgSuccess("转换成功");
                        //  this.value = data;
                        // console.log(data,"_________________________+++")
                        // this.uploadList = [];
                        // this.value = [];
                        // that.item = data; //文件预览显示第一个
                        // that.item.categoryId = this.openInfo.categoryId;
                        this.czlist(data, this.openInfo.categoryId)  //更新页面

                    }
                })

            }).catch(() => {
                this.isItemShow = true;
            });
        },

        //识别
        identifyTap(data) {
            // console.log(data,"----------------------------------")
            var that = this;
            this.isItemShow = false;
            this.$modal.confirm('是否确认识别"' + data.DOC_NAME + '"文件？').then(function () {
            }).then(() => {
                that.loading = true
                identify({
                    categoryId: this.openInfo.categoryId,
                    docId: data.DOC_ID,
                }).then(res => {
                    console.log(res.data,"shibie")
                    if (res.code == "200") {
                        that.loading = false;
                        if( data.DOC_FILE_TYPE.toUpperCase()=="PDF"){  //如果识别的是pdf 文件标题如果是未输入内容的状态下回显转换后接口返回来的数据，如果文件标题已有内容者不覆盖之前内容
                            if(this.inputParams["TITLE"]==undefined||this.inputParams["TITLE"]==null||this.inputParams["TITLE"]==""){
                                this.inputParams["TITLE"]=res.data.title;
                            }
                        }
                        that.$modal.msgSuccess("识别成功");
                        this.czlist(data, this.openInfo.categoryId)  //更新页面
                        // this.isItemShow = true;
                    }
                })

            }).catch(() => {
                this.isItemShow = true;
            });
        },
        //获取input 输入框字段   //data数据，val只有保管期限的字段时触发返回
        onChangeTap(data) {

            if (data.val != undefined) {
                this.inputList = data.queryParams;
            } else {
                this.inputList = data;
            }


            var fileNames = [];
            var fileValues = [];
            for (var i in this.inputList) {
                if (this.inputList.hasOwnProperty(i) && this.inputList[i] !== null) {
                    fileNames.push(i)
                    fileValues.push(this.inputList[i])
                }
            }


            //如果不选择保管期限的情况下掉接口
            //如果输入的和获取归档范围字段一样  则返回true  否则false
            //如果是true 的情况下
            if (data.val == undefined) {
                if (this.containsAllElements(fileNames, this.getfieldbycategoryid)) {
                    getbgqxbyfile(
                        {
                            type: this.openInfo.type,
                            categoryId: this.openInfo.categoryId,
                            fileNames: fileNames,
                            fileValues: fileValues

                        }
                    ).then(res => {
                        // console.log(res, res.msg.substring(0, 2), "--------------")
                        if (res.code == "200") {
                            if (res.msg.substring(0, 2) == "失败") {
                                this.$message({ message: res.msg, type: 'warning' })
                            } else if (res.msg.substring(0, 2) == "成功") {
                                // console.log(res.msg.substring(3), "sdkfjlsdkfjsdklfjklsdjfkdlsjfkdlsfjkdlsj")
                                this.inputParams["BGQX"] = res.msg.substring(3);  //修改获取的输入框参数

                                this.inputList["BGQX"] = res.msg.substring(3); //修改时用来判断提示窗是否有值
                                // console.log(this.inputList, "成功返回数据，------------------------------------------")
                            }

                        }
                    }).catch(res => {

                    })
                }
            }
        },

        // var a=[1,2]  var b=[3,4,1]  判断数组b里面有没有满足数组a的所有数据  js写法
        containsAllElements(b, a) {
            var setB = new Set(b);
            return a.every(item => setB.has(item));
        },
        //取消
        closeDelDialog() {
            this.infoList = [];
            this.value = []; //清空上传文件的列表数据
            this.uploadValue = undefined
            this.$emit("closeDelDialog")
        },

        //确定 、继承追加
        submitDetail(val) {
            var that = this;
            //val==1 继承追加
            //将数据从新排序为了弹窗提示做准备
            var arr = [];
            var arrList = [];
            for (var i in this.infoList) {
                for (var j in this.infoList[i].child) {
                    arrList.push(this.infoList[i].child[j]);
                    if (this.infoList[i].child[j].IS_NO_EMPTY != 0) {
                        arr.push(this.infoList[i].child[j])
                    }
                }
            }
            var column = [];
            for (var n in arr) {
                for (var k in this.inputList) {

                    if (arr[n].FIELD_NAME == k) {
                        arr[n].DEFAULT_VALUE = this.inputList[k]
                    }
                }
                if (arr[n].DEFAULT_VALUE == undefined || arr[n].DEFAULT_VALUE == "null") {
                    this.$message({ message: '请输入' + arr[n].FIELD_CAPTION + '!', type: 'warning' })
                    return
                }


                var DEFAULT_VALUE_INPUT = arr[n].DEFAULT_VALUE.toString(); //trim()方法需要转成成String格式
                console.log(arr[n].DEFAULT_VALUE,"skdlfjdklsj")
                var inputValue = DEFAULT_VALUE_INPUT.trim(); // 去除首尾空格

                if (inputValue === '') {
                    this.$message({ message: '输入' + arr[n].FIELD_CAPTION + '不能全部为空!', type: 'warning' })
                    return
                }
            }
            for (var t in arrList) {
                for (var v in this.inputList) {
                    if (arrList[t].FIELD_NAME == v) {
                        arrList[t].DEFAULT_VALUE = this.inputList[v]
                    }
                }


            }
            if (this.openInfo.IS_DATA_MIGRATION != 1) { //如果是迁移数据不校验关联关系 中铁需求
                var text = ""
                for (var y in arrList) {
                    // console.log(arrList[y],"____")
                    for (var m in this.gxgxList) {
                        if (this.gxgxList[m].FIELDNAME == arrList[y].FIELD_NAME) {
                            if (this.gxgxList[m].FROMLEVEL == 0) {
                                text = "件层"
                            } else if (this.gxgxList[m].FROMLEVEL == 1) {
                                text = "卷层"
                            } else {
                                text = "项目层"
                            }
                            //相等关系 RELATION=0
                            if (this.gxgxList[m].RELATION == 0) {
                                if (this.gxgxList[m].VALUE != arrList[y].DEFAULT_VALUE) {
                                    this.$message({ message: arrList[y].FIELD_CAPTION + '关联关系必须是和' + text + '的' + arrList[y].FIELD_CAPTION + '相等关系哦', type: 'warning' })
                                    return
                                }
                            }

                            //大于等于 RELATION=4
                            if (this.gxgxList[m].RELATION == 4) {
                                var VALUE = this.gxgxList[m].VALUE;
                                var DEFAULT_VALUE = arrList[y].DEFAULT_VALUE;
                                if (this.gxgxList[m].FIELDNAME == "BGQX") {
                                    VALUE = VALUE.substring(1);
                                    DEFAULT_VALUE = DEFAULT_VALUE.substring(1);
                                    var dictValue = this.BGQXList.filter((item) => { return item.dictValue == this.gxgxList[m].VALUE })
                                    var NAME = dictValue[0].dictLabel;
                                    var DEFAULT_dictValue = this.BGQXList.filter((item) => { return item.dictValue == arrList[y].DEFAULT_VALUE })
                                    var DEFAULT_MAME = DEFAULT_dictValue[0].dictLabel;
                                    if (NAME == "永久") {
                                        if (NAME != DEFAULT_MAME) {
                                            this.$message({ message: arrList[y].FIELD_CAPTION + '关联关系必须是大于等于' + text + '的' + arrList[y].FIELD_CAPTION + '哦', type: 'warning' })
                                            return
                                        }

                                    } else {
                                        if (DEFAULT_MAME != "永久") {
                                            if (!(parseInt(VALUE) <= parseInt(DEFAULT_VALUE))) {
                                                this.$message({ message: arrList[y].FIELD_CAPTION + '关联关系必须是大于等于' + text + '的' + arrList[y].FIELD_CAPTION + '哦', type: 'warning' })
                                                return
                                            }

                                        }
                                    }

                                } else {

                                    if (!(parseInt(VALUE) <= parseInt(DEFAULT_VALUE))) {
                                        this.$message({ message: arrList[y].FIELD_CAPTION + '关联关系必须是大于等于' + text + '的' + arrList[y].FIELD_CAPTION + '哦', type: 'warning' })
                                        return
                                    }
                                }

                                //         console.log(parseInt(VALUE) <= parseInt(DEFAULT_VALUE), parseInt(VALUE), NAME, parseInt(DEFAULT_VALUE), DEFAULT_MAME, this.gxgxList[m].VALUE, arrList[y].DEFAULT_VALUE)
                            }

                            //大于  RELATION=1
                            if (this.gxgxList[m].RELATION == 1) {
                                var VALUE = this.gxgxList[m].VALUE;
                                var DEFAULT_VALUE = arrList[y].DEFAULT_VALUE;
                                if (this.gxgxList[m].FIELDNAME == "BGQX") {
                                    VALUE = VALUE.substring(1);
                                    DEFAULT_VALUE = DEFAULT_VALUE.substring(1);
                                    var dictValue = this.BGQXList.filter((item) => { return item.dictValue == this.gxgxList[m].VALUE })
                                    var NAME = dictValue[0].dictLabel;
                                    var DEFAULT_dictValue = this.BGQXList.filter((item) => { return item.dictValue == arrList[y].DEFAULT_VALUE })
                                    var DEFAULT_MAME = DEFAULT_dictValue[0].dictLabel;

                                    if (NAME == "永久") {
                                        this.$message({ message: arrList[y].FIELD_CAPTION + '关联关系必须是大于' + text + '的' + arrList[y].FIELD_CAPTION + '哦', type: 'warning' })
                                        return

                                    } else {
                                        if (DEFAULT_MAME != "永久") {
                                            if (!(parseInt(VALUE) < parseInt(DEFAULT_VALUE))) {
                                                this.$message({ message: arrList[y].FIELD_CAPTION + '关联关系必须是大于' + text + '的' + arrList[y].FIELD_CAPTION + '哦', type: 'warning' })
                                                return
                                            }
                                        }

                                    }

                                } else {
                                    //   console.log(parseInt(VALUE) < parseInt(DEFAULT_VALUE), parseInt(VALUE), parseInt(DEFAULT_VALUE), this.gxgxList[m].VALUE, arrList[y].DEFAULT_VALUE)
                                    if (!(parseInt(VALUE) < parseInt(DEFAULT_VALUE))) {
                                        this.$message({ message: arrList[y].FIELD_CAPTION + '关联关系必须是大于' + text + '的' + arrList[y].FIELD_CAPTION + '哦', type: 'warning' })
                                        return
                                    }
                                }
                            }

                            //小于等于  RELATION=3
                            if (this.gxgxList[m].RELATION == 3) {
                                var VALUE = this.gxgxList[m].VALUE;
                                var DEFAULT_VALUE = arrList[y].DEFAULT_VALUE;

                                if (this.gxgxList[m].FIELDNAME == "BGQX") {
                                    VALUE = VALUE.substring(1);
                                    DEFAULT_VALUE = DEFAULT_VALUE.substring(1);
                                    var dictValue = this.BGQXList.filter((item) => { return item.dictValue == this.gxgxList[m].VALUE })
                                    var NAME = dictValue[0].dictLabel;
                                    var DEFAULT_dictValue = this.BGQXList.filter((item) => { return item.dictValue == arrList[y].DEFAULT_VALUE })
                                    var DEFAULT_MAME = DEFAULT_dictValue[0].dictLabel;
                                    if (NAME == "永久") {
                                    } else {
                                        if (DEFAULT_MAME != "永久") {
                                            if (!(parseInt(VALUE) >= parseInt(DEFAULT_VALUE))) {
                                                this.$message({ message: arrList[y].FIELD_CAPTION + '关联关系必须是小于等于' + text + '的' + arrList[y].FIELD_CAPTION + '哦', type: 'warning' })
                                                return
                                            }
                                        } else {
                                            this.$message({ message: arrList[y].FIELD_CAPTION + '关联关系必须是小于等于' + text + '的' + arrList[y].FIELD_CAPTION + '哦', type: 'warning' })
                                            return
                                        }
                                    }

                                } else {

                                    if (!(parseInt(VALUE) >= parseInt(DEFAULT_VALUE))) {
                                        this.$message({ message: arrList[y].FIELD_CAPTION + '关联关系必须是小于等于' + text + '的' + arrList[y].FIELD_CAPTION + '哦', type: 'warning' })
                                        return
                                    }
                                }

                               //console.log(parseInt(VALUE) >= parseInt(DEFAULT_VALUE), parseInt(VALUE), NAME, parseInt(DEFAULT_VALUE), DEFAULT_MAME, this.gxgxList[m], arrList[y])

                            }


                            //小于  RELATION=2
                            if (this.gxgxList[m].RELATION == 2) {
                                var VALUE = this.gxgxList[m].VALUE;
                                var DEFAULT_VALUE = arrList[y].DEFAULT_VALUE;
                                if (this.gxgxList[m].FIELDNAME == "BGQX") {
                                    VALUE = VALUE.substring(1);
                                    DEFAULT_VALUE = DEFAULT_VALUE.substring(1);
                                    var dictValue = this.BGQXList.filter((item) => { return item.dictValue == this.gxgxList[m].VALUE })
                                    var NAME = dictValue[0].dictLabel;
                                    var DEFAULT_dictValue = this.BGQXList.filter((item) => { return item.dictValue == arrList[y].DEFAULT_VALUE })
                                    var DEFAULT_MAME = DEFAULT_dictValue[0].dictLabel;
                                    //    console.log(NAME, DEFAULT_MAME)
                                    if (NAME == "永久") {
                                        if (DEFAULT_MAME == "永久") {
                                            this.$message({ message: arrList[y].FIELD_CAPTION + '关联关系必须是小于' + text + '的' + arrList[y].FIELD_CAPTION + '哦', type: 'warning' })
                                            return
                                        }
                                    } else {
                                        if (DEFAULT_MAME == "永久") {
                                            this.$message({ message: arrList[y].FIELD_CAPTION + '关联关系必须是小于' + text + '的' + arrList[y].FIELD_CAPTION + '哦', type: 'warning' })
                                            return
                                        } else {
                                            if (!(parseInt(VALUE) > parseInt(DEFAULT_VALUE))) {
                                                this.$message({ message: arrList[y].FIELD_CAPTION + '关联关系必须是小于' + text + '的' + arrList[y].FIELD_CAPTION + '哦', type: 'warning' })
                                                return
                                            }
                                        }

                                    }
                                } else {

                                    if (!(parseInt(VALUE) > parseInt(DEFAULT_VALUE))) {
                                        this.$message({ message: arrList[y].FIELD_CAPTION + '关联关系必须是小于' + text + '的' + arrList[y].FIELD_CAPTION + '哦', type: 'warning' })
                                        return
                                    }
                                }

                                //   console.log(parseInt(VALUE) > parseInt(DEFAULT_VALUE), parseInt(VALUE), parseInt(DEFAULT_VALUE), this.gxgxList[m].VALUE, arrList[y].DEFAULT_VALUE)
                            }

                        }
                    }
                }
            }

            for (var i in this.inputList) {
                column.push({
                    name: i,
                    value: this.inputList[i],
                })
            }


            var ispanduan = false;
            //1.如果有电子文件列表
            if (this.uploadList.length > 0) {
                fbstat().then(res => {  //false=不是分保，true=是分保
                    if (res.data) { //分保的情况下进行密级校验
                        ispanduan = true;
                        var dawjWjmjArr = [];
                        //2.判断电子文件的文件密级不能为空
                        for (var i in this.uploadList) {
                            dawjWjmjArr.push(this.uploadList[i].MJ)
                            if (this.uploadList[i].MJ == null || this.uploadList[i].MJ == "" || this.uploadList[i].MJ == undefined) {
                                this.$message({ message: "请输入" + this.uploadList[i].DOC_NAME + "的文件密级哦~", type: 'warning' })
                                return
                            }
                        }

                        //根据档案密级和文件密级进行判断校验
                        determine({
                            daMj: this.inputList["MJ"],
                            wjMjs: dawjWjmjArr
                        }).then(res => {
                            // console.log(res, res.msg != "ok", "----")
                            if (res.msg != "ok") {
                                this.$message({ message: res.msg, type: 'warning' })
                                return
                            } else {
                                this.submitData(val, column)
                            }

                        })
                    } else {
                        this.submitData(val, column)
                    }
                })

            } else {
                this.submitData(val, column)
            }






        },





        submitData(val, column) {
            // console.log("dkslfjsdlfjsdkljfdklsfj======================================================",this.isParams)
            // console.log("000000000000000提交")
            //离线接收state=1  数字化成果档案接收state=2   数字化成果接收接收管理state=4  数字化成果接收--档案征集 state=5  在线接收state=6  待归档 state=7 文件整理==3
            if (this.isParams == 1 || this.isParams == 3) {
                this.$modal.loading("加载中...")
                if (this.openInfo.ids != undefined) {
                    var data = {
                        categoryId: this.openInfo.categoryId,
                        id: this.openInfo.ids,
                        column: column,
                    }
                    if (this.openInfo.folderId !== undefined) {
                        data["folderId"] = this.openInfo.folderId
                    } else if (this.openInfo.itemId !== undefined) {
                        data["itemId"] = this.openInfo.itemId
                    }
                    //     console.log(this.openInfo.button)
                    if (this.openInfo.button == 'wjzlFile') {
                        // 文件整理修改组件
                        updateYqda1(data).then(res => {
                            this.$modal.closeLoading()
                            this.$modal.msgSuccess("修改成功");

                            this.value = [];
                            this.uploadValue = undefined
                            this.$emit("submitDetail")


                        }).catch(res => {
                            this.$modal.closeLoading()
                        })
                    } else if (this.openInfo.button1 == 'jnjxg') {
                        // 卷内件修改
                        updateYqda2(data).then(res => {
                            this.$modal.closeLoading()
                            this.$modal.msgSuccess("修改成功");

                            this.value = [];
                            this.uploadValue = undefined
                            this.$emit("submitDetail")


                        }).catch(res => {
                            this.$modal.closeLoading()
                        })
                    } else {
                        //修改
                        updateYqda(data).then(res => {
                            this.$modal.closeLoading()
                            this.$modal.msgSuccess("修改成功");

                            this.value = [];
                            this.uploadValue = undefined
                            this.$emit("submitDetail")


                        }).catch(res => {
                            this.$modal.closeLoading()
                        })
                    }
                } else {
                    var data = {
                        categoryId: this.openInfo.categoryId,
                        id: this.openInfo.ids,
                        column: column,
                        eFileCount: this.uploadList.length,
                        daId: this.daId,
                    }
                    if (this.openInfo.folderId !== undefined) {
                        data["folderId"] = this.openInfo.folderId
                    }
                    if (this.openInfo.itemId !== undefined) {
                        data["itemId"] = this.openInfo.itemId
                    }
                    //       console.log(data, this.openInfo, "++++", this.openInfo.button)
                    // console.log(val == "1", val, typeof (val), "1")
                    if (this.openInfo.button1 == 'jnjzl') {
                        // 卷内件著录
                        addYqda1(data).then(res => {
                            this.$modal.closeLoading()
                            this.$modal.msgSuccess("著录成功");

                            if (val == "1") {
                                this.uploadList = [];
                                this.item = []; //文件预览显示第一个
                                this.item["categoryId"] = [];
                                this.value = []; //清空上传文件的列表数据
                                // this.uploadValue = undefined
                                this.getYqdaIdPost(val);
                                console.log("++++++++++++++++有继续追加+++++++++++++++++++++++")
                                this.$emit("submitTooDetail") //继承追加
                            } else {
                                this.value = [];
                                this.uploadValue = undefined
                                this.getYqdaIdPost(val);
                                console.log("++++++++++++++++无继续追加+++++++++++++++++++++++")
                                this.$emit("submitDetail")
                            }
                        }).catch(res => {
                            this.$modal.closeLoading()
                        })
                    } else {
                        //添加
                        addYqda(data).then(res => {
                            this.$modal.closeLoading()
                            this.$modal.msgSuccess("著录成功");

                            if (val == "1") {
                                this.uploadList = [];
                                this.item = []; //文件预览显示第一个
                                this.item["categoryId"] = [];
                                this.value = []; //清空上传文件的列表数据
                                // this.uploadValue = undefined
                                this.getYqdaIdPost(val);
                                this.$emit("submitTooDetail") //继承追加
                            } else {
                                this.value = [];
                                this.uploadValue = undefined
                                this.$emit("submitDetail")
                            }
                        }).catch(res => {
                            this.$modal.closeLoading()
                        })
                    }
                }
            } else if (this.isParams == 2) {
                var data = {
                    categoryId: this.openInfo.categoryId,
                    id: this.openInfo.ids,
                    daId: this.daId,
                    column: column,
                    eFileCount: this.uploadList.length
                }
                if (this.openInfo.folderId !== undefined) {
                    data["folderId"] = this.openInfo.folderId
                } else if (this.openInfo.itemId !== undefined) {
                    data["itemId"] = this.openInfo.itemId
                }
                if (this.openInfo.ids != undefined) {
                    // 数字化成果接收---档案接收---修改
                    updateDaFile(data).then(res => {
                        this.$modal.msgSuccess("修改成功");
                        this.value = [];
                        this.uploadValue = undefined
                        this.$emit("submitDetail")
                    }).catch(res => {
                      this.$modal.closeLoading()
                    })
                } else {
                    // 数字化成果接收---档案接收---添加
                    addDaFile(data).then(res => {
                        this.$modal.msgSuccess("著录成功");
                        this.value = [];
                        this.uploadValue = undefined
                        this.$emit("submitDetail")
                    }).catch(res => {
                      this.$modal.closeLoading()
                    })
                }
            } else if (this.isParams == 4) {
                if (this.openInfo.ids != undefined) {
                    // 数字化成果接收---接收管理---修改
                    updateDaFile(
                        {
                            categoryId: this.openInfo.categoryId,
                            id: this.openInfo.ids,
                            folderId: this.openInfo.folderId,
                            column: column,
                            eFileCount: this.uploadList.length
                        }
                    ).then(res => {
                        this.$modal.msgSuccess("修改成功");
                        this.value = [];
                        this.uploadValue = undefined
                        this.$emit("submitDetail")
                    }).catch(res => {
                      this.$modal.closeLoading()
                    })
                } else {
                    // 数字化成果接收---接收管理---添加
                    addYqdaDajsgl(
                        {
                            categoryId: this.openInfo.categoryId,
                            folderId: this.openInfo.folderId,
                            daId: this.daId,
                            column: column,
                            eFileCount: this.uploadList.length
                        }
                    ).then(res => {
                        this.$modal.msgSuccess("著录成功");
                        this.value = [];
                        this.uploadValue = undefined
                        this.$emit("submitDetail")
                    }).catch(res => {
                      this.$modal.closeLoading()
                    })
                }
            } else if (this.isParams == 5) {
                var data = {
                    categoryId: this.openInfo.categoryId,
                    id: this.openInfo.ids,
                    daId: this.daId,
                    column: column,
                    eFileCount: this.uploadList.length
                }
                console.log(data,"klsdfjksdlfjkldsfjkl")
                if (this.openInfo.folderId !== undefined) {
                    data["folderId"] = this.openInfo.folderId
                } else if (this.openInfo.itemId !== undefined) {
                    data["itemId"] = this.openInfo.itemId
                }
                // 数字化成果接收--档案征集
                if (this.openInfo.ids != undefined) {
                    // 数字化成果接收---档案征集---修改
                    updateYqda(data).then(res => {
                        this.$modal.msgSuccess("修改成功");
                        this.value = [];
                        this.uploadValue = undefined
                        this.$emit("submitDetail")
                    }).catch(res => {
                      this.$modal.closeLoading()
                    })
                } else {
                    // 数字化成果接收---档案征集---添加
                    addZjYqda(data).then(res => {
                        this.$modal.msgSuccess("著录成功");
                        this.value = [];
                        this.uploadValue = undefined
                        this.$emit("submitDetail")
                    }).catch(res => {
                      this.$modal.closeLoading()
                    })
                }
            } else if (this.isParams == 6) {
                this.$modal.loading("加载中...")
                // 在线收集
                if (this.openInfo.ids != undefined) {
                    var data = {
                        categoryId: this.openInfo.categoryId,
                        id: this.openInfo.ids,
                        column: column,
                    }
                    if (this.openInfo.folderId !== undefined) {
                        data["folderId"] = this.openInfo.folderId
                    } else if (this.openInfo.itemId !== undefined) {
                        data["itemId"] = this.openInfo.itemId
                    }
                    if (this.openInfo.button1 == 'jnjxg') {
                        // 卷内件修改
                        updateYqdaZxjs(data).then(res => {
                            this.$modal.closeLoading()
                            this.$modal.msgSuccess("修改成功");

                            this.value = [];
                            this.uploadValue = undefined
                            this.$emit("submitDetail")


                        }).catch(res => {
                            this.$modal.closeLoading()
                        })
                    } else {
                        //修改
                        updateYqda(data).then(res => {
                            this.$modal.closeLoading()
                            this.$modal.msgSuccess("修改成功");

                            this.value = [];
                            this.uploadValue = undefined
                            this.$emit("submitDetail")


                        }).catch(res => {
                            this.$modal.closeLoading()
                        })
                    }
                } else {
                    var data = {
                        categoryId: this.openInfo.categoryId,
                        id: this.openInfo.ids,
                        column: column,
                        eFileCount: this.uploadList.length,
                        daId: this.daId,
                    }
                    if (this.openInfo.folderId !== undefined) {
                        data["folderId"] = this.openInfo.folderId
                    }
                    if (this.openInfo.itemId !== undefined) {
                        data["itemId"] = this.openInfo.itemId
                    }
                    if (this.openInfo.button1 == 'jnjzl') {
                        addYqdaZxjs2(data).then(res => {
                            this.$modal.closeLoading()
                            this.$modal.msgSuccess("著录成功");
                            this.value = [];
                            this.uploadValue = undefined
                            this.$emit("submitDetail")
                        }).catch(res => {
                          this.$modal.closeLoading()
                        })
                    } else {
                        addYqdaZxjs(data).then(res => {
                            this.$modal.closeLoading()
                            this.$modal.msgSuccess("著录成功");
                            this.value = [];
                            this.uploadValue = undefined
                            this.$emit("submitDetail")
                        }).catch(res => {
                          this.$modal.closeLoading()
                        })
                    }
                }
            } else if (this.isParams == 7) {
                this.$modal.loading("加载中...")
                if (this.openInfo.ids != undefined) {
                    var data = {
                        categoryId: this.openInfo.categoryId,
                        id: this.openInfo.ids,
                        column: column,
                    }
                    if (this.openInfo.folderId !== undefined) {
                        data["folderId"] = this.openInfo.folderId
                    } else if (this.openInfo.itemId !== undefined) {
                        data["itemId"] = this.openInfo.itemId
                    }
                    //修改
                    updateYqdaDgd(data).then(res => {
                        this.$modal.closeLoading()
                        this.$modal.msgSuccess("修改成功");

                        this.value = [];
                        this.uploadValue = undefined
                        this.$emit("submitDetail")


                    }).catch(res => {
                        this.$modal.closeLoading()
                    })
                } else {
                    var data = {
                        categoryId: this.openInfo.categoryId,
                        id: this.openInfo.ids,
                        column: column,
                        eFileCount: this.uploadList.length,
                        daId: this.daId,
                    }
                    if (this.openInfo.folderId !== undefined) {
                        data["folderId"] = this.openInfo.folderId
                    }
                    if (this.openInfo.itemId !== undefined) {
                        data["itemId"] = this.openInfo.itemId
                    }
                    //添加
                    addYqdaDgd(data).then(res => {
                        this.$modal.closeLoading()
                        this.$modal.msgSuccess("著录成功");

                        if (val == "1") {
                            this.uploadList = [];
                            this.item = []; //文件预览显示第一个
                            this.item["categoryId"] = [];
                            this.value = []; //清空上传文件的列表数据
                            // this.uploadValue = undefined
                            this.getYqdaIdPost(val);
                            this.$emit("submitTooDetail") //继承追加
                        } else {
                            this.value = [];
                            this.uploadValue = undefined
                            this.$emit("submitDetail")
                        }
                    }).catch(res => {
                        this.$modal.closeLoading()
                    })
                }
            }
        }


        // 自定义上传

        // // 文件上传 - 文件选中后上传
        // handleChange(file, fileList) {
        //     /* 自动上传改成true会导致重复触发，所以在handleChange上传文件*/
        //     //  防抖
        //     let length = fileList.length
        //     this.maxLength = Math.max(length, this.maxLength)
        //     setTimeout(() => {
        //         if (length === this.maxLength) {
        //             // 你的上传文件逻辑
        //             this.$refs.uploadComp.submit();
        //             this.fileLimit(file, fileList);
        //         }
        //     }, 100)

        // },
        // //开始上传文件
        // uploadFile(content) {
        //     if (this.uploadValue != undefined) {
        //         const formData = new FormData();
        //         formData.append("file", content.file);
        //         formData.append("categoryId", this.openInfo.categoryId);
        //         formData.append("type", this.uploadValue);
        //         formData.append("daId", this.daId);//组件id
        //         //发送请求
        //         upload(formData).then(res => {
        //             // console.log(res, "dskljfklsdjf")
        //             this.uploadFiles.push(res.data.docInfo)
        //             this.fileList = [] // 清空图片已经上传的图片列表（绑定在上传组件的file-list）
        //             this.maxLength = 0 // 恢复默认值
        //         })

        //     } else {
        //         this.$message.warning(`请选择文件类型`);
        //         this.fileList = [] // 清空图片已经上传的图片列表（绑定在上传组件的file-list）
        //         this.maxLength = 0 // 恢复默认值
        //     }
        // },
        // //限制上传附件
        // fileLimit(file, fileList) {
        //     const extension = file.name.substring(file.name.lastIndexOf('.') + 1);
        //     const size = file.size / 1024 / 1024;
        //     // if (extension !== 'zip') {
        //     //     this.$message.warning('只能传后缀名为.zip的压缩文件')
        //     //     return
        //     // }
        //     if (size > 5) {
        //         this.$message.warning("文件大小不得超过5M");
        //         return;
        //     }

        // },
        // //文件上传 - 成功回调
        // handleAvatarSuccess2(res, file, fileList) {
        //     console.log(res, file, fileList, "00000000000000000000");
        // },
        // // 文件上传 - 限制上传  :limit=""  的时候搭配使用
        // handleExceed2(files, fileList) {
        //     console.log(files, fileList)
        //     this.$message.warning(`当前限制选择 1 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
        // },
    }
}
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__body {
    padding: 0 20px 10px !important;
}

.contain {
    width: 100%;
    height: 770px;
    border: 1px solid #DCDFE6;
}

.leftMain {
    overflow: auto;
    height: 470px;
}

.upLoadMain {
    margin-top: 20px;
    margin-left: 40px;

    button {
        margin-left: 20px;
    }
}

.margin_top {
    margin-top: 20px;
}

::v-deep .el-dialog {
    margin: 30px auto 0 !important;
}
</style>
